#ifndef GAMEENGINE_GRAPHICS_MESHES_BONESYSTEMS_BONE_KEYFRAME_H
#define GAMEENGINE_GRAPHICS_MESHES_BONESYSTEMS_BONE_KEYFRAME_H

#include <GameEngine/Graphics/graphics_settings.h>

#include <GameEngine/Core/time_defs.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//=================================================================================

//! Parametric keyframe that applies to a bone in a bone system
/*!
 *  This class implements the arguments that must be used in the animation of a bone-based system (also
 *  known as skeletal system, or skinning mesh). A bone keyframe is made of a starting time, a length,
 *  and three arguments that typically represent either rotation or translation along the three Cartesian
 *  axes (X, Y and Z).
 *
 *  A keyframe has no knowledge of which type of information it is actually holding; it is the bone system
 *  responsability to interpret this information, typically using separate lists for translation and rotation
 *  keyframes. The keyframe does not either know which bone of the mesh it applies to; this management is
 *  also deferred to higher level classes.
 */
class _Graphics_decl BoneKeyframe {

public:
	//! Enumerator used to handle the index of an argument of the keyframe
	enum ArgumentIndex {
		//! The first argument index, i.e., translation or rotation along/around the X axis
		First = 0,
		//! The first argument index, i.e., translation or rotation along/around the Y axis
		Second = 1,
		//! The first argument index, i.e., translation or rotation along/around the Z axis
		Third = 2,
	};

public:
	BoneKeyframe();
	BoneKeyframe(Time::Seconds time, Time::Seconds length, float arg1 = 0.0f, float arg2 = 0.0f, float arg3 = 0.0f);
	BoneKeyframe(const BoneKeyframe& rhs);
	virtual ~BoneKeyframe();
	BoneKeyframe& operator=(const BoneKeyframe& rhs);

	Time::Seconds time() const;
	Time::Seconds& time();
	Time::Seconds length() const;
	Time::Seconds& length();

	float argument(ArgumentIndex index) const;
	void set_argument(ArgumentIndex index, float value = 0.0f);

protected:
	//! The time at which the keyframe applies
	Time::Seconds time_;
	//! The length for which the keyframe applies
	Time::Seconds length_;

	//! The arguments of the keyframe
	float arguments_[3];
};

//=================================================================================

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
